package com.tt.mymu.controller;

import com.tt.mymu.entity.Carousel;
import com.tt.mymu.service.CarouselService;
import com.tt.mymu.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/carousel")
public class CarouselController {
    @Autowired
    private CarouselService carouselService;

    /**
     * 获取所有列表
     * @return
     */
    @RequestMapping("getListCarousel")
    public Result getListCarousel() {
        return carouselService.getListCarousel();
    }

    /**
     * 删除轮播
     * @param id
     * @return
     */
    @RequestMapping("deleteCarouselById")
    public Result deleteCarouselById(int id) {
        return carouselService.deleteCarouselById(id);
    }

    @RequestMapping("addCarousel")
    public Result addCarousel(Carousel carousel) {
        return carouselService.addCarousel(carousel);
    }

}
